<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>canvas</title>
    <style>
        #myCanvas {
        background-color:lightpink;
        }
    </style>
</head>
<body>
<canvas id="myCanvas" width="600" height="600">
    您的浏览器不支持Canvas，请升级浏览器
</canvas>
<script>
    var canvas = document.getElementById('myCanvas');
    var ctx = canvas.getContext('2d');
    ctx.beginPath();
    ctx.moveTo(0, 50);
    ctx.lineTo(50, 50);
    ctx.lineTo(50, 100);
    ctx.lineTo(100, 100);
    ctx.lineTo(100, 150);
    ctx.lineTo(150, 150);
    ctx.lineTo(150, 200);
    ctx.lineTo(200, 200);
    ctx.lineTo(200, 250);
    ctx.stroke();

    ctx.beginPath();
    ctx.moveTo(0, 250);
    ctx.lineTo(200, 250);
    ctx.stroke();

</script>
</body>
</html>